<?php

include 'app/webmail.php';

$oInputData = new CInputData();

$sAuth = $oInputData->GetHeaderValue('X-WM-CACHE', '');
$sIfNoneMatch = $oInputData->GetHeaderValue('If-None-Match', '');
$sETag = md5(time());

if (0 < strlen($sAuth) && 'clear' !== $sAuth)
{
	header('HTTP/1.1 200 OK');
	header('Cache-Control: must-revalidate');
	header('Content-Type: text/javascript; charset=utf-8');
	header('ETag: "'.$sETag.'"');

	echo 'window.x_wm_auth=\''.$_SERVER['HTTP_X_WM_CACHE'].'\';';
}
else if (0 < strlen($sIfNoneMatch) && 'clear' !== $sAuth)
{
	header('HTTP/1.1 304 Not Modified');
}
else
{
	header('HTTP/1.1 200 OK');
	header('Cache-Control: must-revalidate');
	header('Content-Type: text/javascript; charset=utf-8');
	header('ETag: "'.$sETag.'"');

	echo 'window.x_wm_auth=\'\';';
}

exit();